<?php use_helper('I18N') ?>

<script type="text/javascript">
$(function(){
    $(".editLink").button({
        icons: {
            primary: "ui-icon-circle-check"
        }
    })
    $("#btnCreate").button({
        icons: {
            primary: "ui-icon-circle-plus"
        }
    })
});
</script>
<div style="padding: 10px; top: 10px; width: 98%">
    <div class="portlet" id="sf_admin_container">
        <div class="portlet-header">Categories</div>
        <div class="portlet-content" id="sf_admin_content" style="width: 98%">
            <table class="sf_admin_list" width="100%">
                <thead>
                <tr>
                    <th>Categories</th>
                    <th>Categories Name</th>
                    <th>Categories Desc</th>
                    <th>Categories Name (Chinese)</th>
                    <th>Categories Desc (Chinese)</th>
                    <th>Status</th>
                    <th>Photo</th>
                </tr>
                </thead>
                <tbody>
                <?php
                $className = "sf_admin_row_1";
                foreach ($cms_categoriess as $cms_categories):
                    if ($className == "sf_admin_row_0") {
                        $className = "sf_admin_row_1";
                    } else {
                        $className = "sf_admin_row_0";
                    }
                ?>
                <script type="text/javascript">
                    $(function(){
                        $("a[rel=image_group<?php echo $cms_categories->getCategoriesId() ?>]").fancybox({
                            'transitionIn' : 'elastic',
                            'transitionOut' : 'none'
                        });
                    });
                </script>
                <tr class="<?php echo $className?>">
                    <td><?php echo link_to("Edit", 'settings/categoriesEdit?categories_id=' . $cms_categories->getCategoriesId(), array ('class' => 'editLink')) ?></td>
                    <td><?php echo $cms_categories->getCategoriesName() ?></td>
                    <td><?php echo $cms_categories->getCategoriesDesc() ?></td>
                    <td><?php echo $cms_categories->getCategoriesNameCn() ?></td>
                    <td><?php echo $cms_categories->getCategoriesDescCn() ?></td>
                    <td><?php echo $cms_categories->getStatusCode() ?></td>
                    <td><?php //echo url_for("uploads/product/").$cms_categories->getCategoriesPhoto() ?>
                        <?php echo "<a rel='image_group".$cms_categories->getCategoriesId()."' href='/uploads/category/ori-".$cms_categories->getCategoriesPhoto()."'>"; ?>
                            <img onerror="this.src='/images/common/not_available.gif';"
                             src="<?php echo '/'.sfConfig::get('sf_upload_dir_name').'/category/'.$cms_categories->getCategoriesPhoto(); ?> "
                             height="50"
                             alt="Click me to enlarge image">
                        </a>
                    </td>
                </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
            <br>
            <div style="text-align: right">
                <?php echo link_to('create', 'settings/categoriesCreate', array("id" => "btnCreate")) ?>
            </div>

        </div>
    </div>
</div>
